//
// Created by lenovo on 2023/12/25.
//
#include<bits/stdc++.h>
using namespace std;
int  n, m, nam[1000006];
int dhy(int x)
{
    int l = 1 , r = n;
    while(l < r)
    {
        int mid = (l + r - 1)/2;
        if(nam[mid] >= x)
            r = mid;
        else
            l = mid + 1;
    }
    if(nam[l] == x)
        return l;
    else
        return -1;
}
int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n;i++)
    {
        cin >> nam[i];
    }
    while(m--)
    {
        int tem = 0;
        cin >> tem;
        int ans = dhy(tem);
        cout << ans << ' ';
    }
    return 0;
}
